# -*- coding: utf-8 -*-
"""

Created on Thu Jun 18 10:11:09 2020

@author: Farman
"""

import ListFiles as lister
import pathlib
import joblib
 
path_china = '/data/yule/disk2/GongPeng2010'
path_usa   = '/data/yule/disk2/ESACCI/2010'

files_china = lister.list_files_non_recursive(path_china, '*')
files_usa   = lister.list_files_non_recursive(path_usa,   '*')

path_china = pathlib.Path(path_china)
path_usa   = pathlib.Path(path_usa)

f = files_usa[0]
f = pathlib.Path(f).name
f = str(f)
tail = f[f.find('-'):]

file_pairs = []

for fchina in files_china:
    fusa = pathlib.Path(fchina).name
    fusa = str(fusa)
    fusa = fusa[:fusa.find('_')] + tail
    fusa = path_usa/fusa
    file_pairs.append((str(fchina), str(fusa)))


joblib.dump(file_pairs, 'clscmp_pair_china_usa.joblib')
